package com.eascs.web.o2o.web.service.dubbo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.config.annotation.Service;
import com.eascs.app.dao.PageResult;
import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.report.common.entity.ModelResult;
import com.eascs.report.common.entity.ProvinceTeamTotalForm;
import com.eascs.report.common.entity.ReportStatForm;
import com.eascs.report.common.service.ReportDubboService;
import com.eascs.web.o2o.web.service.ReportStatService;

@Service
public class ReportDubboServiceImpl implements ReportDubboService {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	ReportStatService reportStatService;
	

	@Override
	public ModelResult<PageResult<Object[]>> queryTeamTotalByPage(ProvinceTeamTotalForm entity) {
		logger.info("按团队统计放款量");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getTeamTotalByPageForExcle(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("按团队统计放款量 method queryTeamTotalByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryTeamTotalByPage error", e.getMessage());
		}
		return modelResult;
	}

	@Override
	public ModelResult<PageResult<Object[]>> queryProvinceTotalByPage(ProvinceTeamTotalForm entity) {
		logger.info("按省区统计放款量");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getProvinceTotalByPage(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("按省区统计放款量 method queryProvinceTotalByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryProvinceTotalByPage error", e.getMessage());
		}
		return modelResult;
	}

	
	@Override
	public ModelResult<PageResult<Object[]>> queryOperatorTotalByPage(ProvinceTeamTotalForm entity) {
		logger.info("按经办人统计放款量");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getOperatorTotalByPageForExcle(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("按经办人统计放款量 method queryOperatorTotalByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryOperatorTotalByPage error", e.getMessage());
		}
		return modelResult;
	}


	@Override
	public ModelResult<PageResult<Object[]>> queryTeamTotalSectionByPage(ProvinceTeamTotalForm entity) {
		logger.info("按团队统计时间区间放款量");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getTeamTotalSectionByPageForExcle(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("按团队统计时间区间放款量 method queryTeamTotalSectionByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryTeamTotalSectionByPage error", e.getMessage());
		}
		return modelResult;
	}

	@Override
	public ModelResult<PageResult<Object[]>> queryProvinceTotalSectionByPage(ProvinceTeamTotalForm entity) {
		logger.info("按省区统计时间区间放款量");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getProvinceTotalSectionByPage(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("按省区统计时间区间放款量 method queryProvinceTotalSectionByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryProvinceTotalSectionByPage error", e.getMessage());
		}
		return modelResult;
	}

	
	@Override
	public ModelResult<PageResult<Object[]>> queryOperatorTotalSectionByPage(ProvinceTeamTotalForm entity) {
		logger.info("按信贷经理统计时间区间放款量");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getOperatorTotalSectionByPageForExcle(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("按信贷经理统计时间区间放款量 method queryOperatorTotalSectionByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryOperatorTotalSectionByPage error", e.getMessage());
		}
		return modelResult;
	}
	
	@Override
	public ModelResult<PageResult<Object[]>> queryReportStatByPlatformByPage(ReportStatForm entity) {
		logger.info("业务按平台统计");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getReportStatByPlatformByPage(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("业务按平台统计 method queryReportStatByPlatformByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryReportStatByPlatformByPage error", e.getMessage());
		}
		return modelResult;
	}
	
	
	
	@Override
	public ModelResult<PageResult<Object[]>> queryReportStatByProvinceByPage(ReportStatForm entity) {
		logger.info("业务按省区统计");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getReportStatByProvinceByPage(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("业务按省区统计 method queryReportStatByProvinceByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryReportStatByProvinceByPage error", e.getMessage());
		}
		return modelResult;
	}
	
	@Override
	public ModelResult<PageResult<Object[]>> queryReportStatByOperatorByPage(ReportStatForm entity) {
		logger.info("业务按信贷经理统计");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getReportStatByDimissionByPage(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("业务按信贷经理统计 method queryReportStatByOperatorByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryReportStatByOperatorByPage error", e.getMessage());
		}
		return modelResult;
	}
	
	@Override
	public ModelResult<PageResult<Object[]>> queryReportStatByBankreFundByPage(ReportStatForm entity) {
		logger.info("业务按银行统计");
		ModelResult<PageResult<Object[]>> modelResult=new ModelResult<>();
		try {
			PageResult<Object[]> pageResult =reportStatService.getReportStatByBankreFundByPage(entity);
			modelResult.withModel(pageResult);
		} catch (Exception e) {
			logger.error("业务按银行统计 method queryReportStatByBankreFundByPage:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService queryReportStatByBankreFundByPage error", e.getMessage());
		}
		return modelResult;
	}
	
	
	@Override
	public ModelResult<List<Object[]>> getLikeEmployeeList(String empName) {
		logger.info("客户列表");
		ModelResult<List<Object[]>> modelResult=new ModelResult<>();
		try {
			List<Object[]> list =reportStatService.getLikeEmployeeList(empName);
			modelResult.withModel(list);
		} catch (Exception e) {
			logger.error("客户列表 method getLikeEmployeeList:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService getLikeEmployeeList error", e.getMessage());
		}
		return modelResult;
	}
	
	
	@Override
	public ModelResult<List<Object[]>> getLikePostList(ProvinceTeamTotalForm entity) {
		logger.info("职位列表");
		ModelResult<List<Object[]>> modelResult=new ModelResult<>();
		try {
			List<Object[]> list =reportStatService.getLikePostList(entity);
			modelResult.withModel(list);
		} catch (Exception e) {
			logger.error("职位列表 method getLikePostList:[{}]", e.getMessage());
			modelResult.withError("ReportDubboService getLikePostList error", e.getMessage());
		}
		return modelResult;
	}
	
	
	
}
